package com.zj.thread.callable;

import java.util.Random;
import java.util.concurrent.Callable;


public class MyTask implements Callable<Integer>{
    int num;
    MyTask(int i){
        this.num=i;
    }
    @Override
    public Integer call() throws Exception {
        int t = new Random().nextInt(10);
        System.out.println(Thread.currentThread().getName() +" task "+num+" start");
        Integer randomNumber =t+1;
        Thread.sleep(randomNumber * 1000);
        System.out.println("task "+num+" wait time:"+randomNumber);

//        if(randomNumber==5){
//            int i=2/0;
//        }
        return randomNumber;
    }
}
